import socket

class client():
    def __init__(self) -> None:
        self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.client_socket.connect(("127.0.0.1", 8080))

    def send_data(self, data):
        self.client_socket.send(data.encode("utf8")) 
        return data   
    
    def get_data(self):
        content = self.client_socket.recv(1024).decode("utf8")
        return content
    
    def close(self):
        self.client_socket.close()
    

if __name__ == "__main__":
    client1 = client()
    data = client1.get_data()
    print(data)
    client1.send_data(data)
    client1.close()
